home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Learning Director.dcr / UtilsCast_4_MS_Buttons.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  2.5 KB  |  100 lines

  1. on DoButtonHit style, targetSprite, inCast, outCast, inCmd, outCmd, whileDownCmd, soundDown, soundUp, simClick
  2.   if stringp(inCast) then
  3.     set inCast to the number of member inCast
  4.   end if
  5.   if stringp(outCast) then
  6.     set outCast to the number of member outCast
  7.   end if
  8.   if stringp(soundDown) then
  9.     set soundDown to the number of member soundDown
  10.   end if
  11.   if stringp(soundUp) then
  12.     set soundUp to the number of member soundUp
  13.   end if
  14.   if style = #be_pushButton then
  15.     set style to 0
  16.   else
  17.     if style = #be_toggleButton then
  18.       set style to 1
  19.     else
  20.       if style = #be_radioButton then
  21.         set style to 2
  22.       else
  23.         if symbolp(style) then
  24.           set style to -1
  25.         end if
  26.       end if
  27.     end if
  28.   end if
  29.   if (style < 0) or (style > 2) then
  30.     return 
  31.   end if
  32.   if (style = 2) or (the castNum of sprite targetSprite = outCast) then
  33.     set theInCast to inCast
  34.     set theOutCast to outCast
  35.   else
  36.     set theInCast to outCast
  37.     set theOutCast to inCast
  38.   end if
  39.   if (style = 2) and (the castNum of sprite targetSprite = inCast) then
  40.     exit
  41.   end if
  42.   if soundDown > 0 then
  43.     puppetSound(1, soundDown)
  44.   end if
  45.   puppetSprite(targetSprite, 1)
  46.   set fastClick to 0
  47.   if the stillDown then
  48.     repeat while the mouseDown
  49.       if rollOver(targetSprite) = 0 then
  50.         set the castNum of sprite targetSprite to theOutCast
  51.       else
  52.         set the castNum of sprite targetSprite to theInCast
  53.         if whileDownCmd <> EMPTY then
  54.           do(whileDownCmd)
  55.         end if
  56.       end if
  57.       updateStage()
  58.     end repeat
  59.   else
  60.     if simClick or (the lastClick < 30) then
  61.       set fastClick to 1
  62.       set the castNum of sprite targetSprite to theInCast
  63.       updateStage()
  64.       startTimer()
  65.       repeat while the timer < 15
  66.       end repeat
  67.     end if
  68.   end if
  69.   if (soundDown > 0) and (soundUp > 0) then
  70.     sound stop 1
  71.   end if
  72.   if (rollOver(targetSprite) = 1) or fastClick then
  73.     if soundUp > 0 then
  74.       puppetSound(1, soundUp)
  75.     end if
  76.     if fastClick and (whileDownCmd <> EMPTY) then
  77.       do(whileDownCmd)
  78.     end if
  79.     set releaseWithInCast to the castNum of sprite targetSprite = inCast
  80.     if style = 0 then
  81.       set the castNum of sprite targetSprite to theOutCast
  82.       updateStage()
  83.     else
  84.       if style = 1 then
  85.       end if
  86.     end if
  87.     if releaseWithInCast then
  88.       do(inCmd)
  89.     else
  90.       do(outCmd)
  91.     end if
  92.   else
  93.     if style = 0 then
  94.       set the castNum of sprite targetSprite to theOutCast
  95.       updateStage()
  96.     end if
  97.   end if
  98.   return releaseWithInCast
  99. end
  100.